net: hns3: call hns3_nic_net_open() while doing HNAE3_UP_CLIENT
authorHuazhong Tan <tanhuazhong@huawei.com>
Mon, 31 Dec 2018 02:58:29 +0000 (10:58 +0800)
committerSalvatore Bonaccorso <carnil@debian.org>
Thu, 18 Jul 2019 22:23:17 +0000 (23:23 +0100)
For HNAE3_DOWN_CLIENT calling hns3_nic_net_stop(), HNAE3_UP_CLIENT
should call hns3_nic_net_open(), since if the number of queue or
the map of TC has is changed before HHAE3_UP_CLIENT is called,
it will cause problem.

Also the HNS3_NIC_STATE_RESETTING flag needs to be cleared before
hns3_nic_net_open() called, and set it back while hns3_nic_net_open()
failed.

Fixes: bb6b94a896d4 ("net: hns3: Add reset interface implementation in client")
Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com>
Signed-off-by: Peng Li <lipeng321@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Gbp-Pq: Topic bugfix/arm64/huawei-taishan
Gbp-Pq: Name 0026-net-hns3-call-hns3_nic_net_open-while-doing-HNAE3_UP.patch

drivers/net/ethernet/hisilicon/hns3/hns3_enet.c

index 0ccfa6a845353618f9404259d7d837fdd7dec45e..895c43fd1d81c3742c0595722be297d8b9699af2 100644 (file)
@@ -3439,11 +3439,15 @@ static int hns3_reset_notify_down_enet(struct hnae3_handle *handle)
 static int hns3_reset_notify_up_enet(struct hnae3_handle *handle)
 {
        struct hnae3_knic_private_info *kinfo = &handle->kinfo;
+       struct hns3_nic_priv *priv = netdev_priv(kinfo->netdev);
        int ret = 0;
 
+       clear_bit(HNS3_NIC_STATE_RESETTING, &priv->state);
+
        if (netif_running(kinfo->netdev)) {
-               ret = hns3_nic_net_up(kinfo->netdev);
+               ret = hns3_nic_net_open(kinfo->netdev);
                if (ret) {
+                       set_bit(HNS3_NIC_STATE_RESETTING, &priv->state);
                        netdev_err(kinfo->netdev,
                                   "hns net up fail, ret=%d!\n", ret);
                        return ret;